package com.test.java;

import java.util.Scanner;

/**
 * 求素数/令Pi表示第i个素数。现任给两个正整数M <= N <= 10000，请输出PM到PN的所有素数。
 * =============================================================
 * Version          Author          Date            Description
 * 1.0              白建         2017/12/9             创建
 * =============================================================
 */
public class Java_2
{

    private static int begin, end;

    public static void main(String[] args)
    {

        init();
        process();
    }

    private static void init()
    {

        Scanner scanner = new Scanner(System.in);
        begin = scanner.nextInt();
        end = scanner.nextInt();
    }

    private static void process()
    {

        short linenum = 0, count = 0;
        for (int i = 2; count <= end; i++)
        {
            if (checkForPrime(i))
            {
                count++;
                if (count >= begin && count <= end)
                {
                    linenum++;
                    if (linenum != 1)
                    {
                        System.out.print(" ");
                    }
                    if (linenum >= 10)
                    {
                        System.out.print(i);
                        System.out.print("\n");
                        linenum = 0;
                    }
                    else
                    {
                        System.out.print(i);
                    }
                }
            }
        }
    }

    private static boolean checkForPrime(int i)
    {

        for (int k = 2; k <= Math.sqrt(i); k++)
        {
            if (i % k == 0)
            {
                return false;
            }
        }
        return true;
    }
}
